<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1 align="center">欢迎光临管理系统</h1>
<div sec:authorize="!isAuthenticated()">
	<h2 align="center">游客您好，如果想查看 <a th:href="@{/userlogin}">请登录</a></h2>
</div>
<div sec:authorize="isAuthenticated()">
	<h2 align="center"><span sec:authentication="name"></span>您好，您的角色有：
		<span sec:authentication="principal.authorities"></span></h2>
	<form th:action="@{/logout}" method="post">
		<input type="submit" value="注销"/>
	</form>
</div>
<hr>

<div sec:authorize="hasRole('VIP1')">
	<h3>初级</h3>
	<ul>
		<li><a th:href="@{/level1/1}">初级1</a></li>
		<li><a th:href="@{/level1/2}">初级2</a></li>
		<li><a th:href="@{/level1/3}">初级3</a></li>
	</ul>
</div>

<div sec:authorize="hasRole('VIP2')">
	<h3>中级</h3>
	<ul>
		<li><a th:href="@{/level2/1}">中级1</a></li>
		<li><a th:href="@{/level2/2}">中级2</a></li>
		<li><a th:href="@{/level2/3}">中级3</a></li>
	</ul>
</div>

<div sec:authorize="hasRole('VIP3')">
	<h3>高级</h3>
	<ul>
		<li><a th:href="@{/level3/1}">高级1</a></li>
		<li><a th:href="@{/level3/2}">高级2</a></li>
		<li><a th:href="@{/level3/3}">高级3</a></li>
	</ul>

</div>

</body>
</html>
